home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
printing
/
prtset.arc
/
PRTSET.S
< prev
next >
Wrap
Internet Message Format
|
1989-03-31
|
7KB
From @CORNELLC.ccs.cornell.edu:NTOMCZAK@UALTAVM Wed Mar 29 00:34:11 1989
Received: from CORNELLC.ccs.cornell.edu ([128.253.1.19]) by ssyx.ucsc.edu (4.0/1.1)
id AA06846; Wed, 29 Mar 89 00:34:04 PST
Message-Id: <8903290834.AA06846@ssyx.ucsc.edu>
Received: from UALTAVM by CORNELLC.ccs.cornell.edu (IBM VM SMTP R1.2.1MX) with BSMTP id 0401; Wed, 29 Mar 89 03:33:47 EST
Received: by UALTAVM (Mailer X1.25) id 6719; Wed, 29 Mar 89 01:32:37 MST
Date: Wed, 29 Mar 89 01:30:02 MST
From: Michal Jaegermann <NTOMCZAK%UALTAVM.BITNET@CORNELLC.CIT.CORNELL.EDU>
Subject: Re: prtset
To: Steven Grimm <koreth@ssyx>
In-Reply-To: Your message of Tue, 28 Mar 89 21:58:33 PST
Status: R
Line noise was actually quite bad. :-). Ok, here is the rest
-------------------------------------------------------------------------
Steve,
I've already seen posted other parts of this mailing. This file
has to be the most persistently refusing to transfer which I ever
seen. Hope that this clear ASCII text will get to you in more or less
one piece.
Regards,
Michal
------- cut here ----------------
*****************************************************************
* *
* prtset.s version 1.1 *
* Michal Jaegermann, September 1988 *
* *
* this software is released to a public domain - *
* enjoy every way you like *
* *
*****************************************************************
* character codes
tab equ 9
lf equ 10
cr equ 13
* gemdos & (x)bios equates
gemdos equ 1
bios equ 13
xbios equ 14
conin equ 1
conout equ 2
auxout equ 4
prnout equ 5
poutst equ $11
aoutst equ $13
cconws equ 9
pterm equ $4c
setprt equ 33
.text
init:
* move.w #-1,d0 ; find current printer configuration
bsr oldcnf
move.w d0,prcnfg
move.w #prnout,prdev
btst #4,d0
beq.s getarg
move.w #auxout,prdev
getarg:
move.l 4(sp),a6
adda.w #$80,a6 ; a6 points to argument string start
moveq.l #0,d0
move.b (a6)+,d0 ; Get string length and
clr.b (a6,d0.w) ; ensure '\0' termination
sf somearg
nxtarg:
skipwh:
bsr getch
testch:
tst.b d0
beq done ; '\0' char is end of string
cmp.b #' ',d0
beq skipwh
cmp.b #tab,d0
beq skipwh
cmp.b #'-',d0
beq skipwh
*
st somearg
opto:
cmp.b #'O',d0
bne.s optn
bsr shwcnf
bra.s nxtarg
optn:
cmp.b #'N',d0
bne.s optc
bsr newcnf
bra.s nxtarg
optc:
cmp.b #'C',d0 ; using continuous paper
bne.s opts
move.w prcnfg,d0
bclr #5,d0
bsr prconf
bra.s nxtarg
opts:
cmp.b #'S',d0 ; using single-sheet
bne.s opthx
move.w prcnfg,d0
bset #5,d0
bsr prconf
bra.s nxtarg
opthx:
cmp.b #'H',d0 ; hex escape
bne.s usage
bsr sendc ; return code quietly ignored
bra.s testch
*
done:
tst.b somearg
beq.s usage
move.w #0,-(sp) ; clear status
bra.s term
usage:
pea.l usemsg ; If error in arg string show usage message
move.w #cconws,-(sp)
trap #gemdos
addq.l #6,sp
move.w #conin,-(sp) ; wait for keypress to mollify desktop
trap #gemdos
* addq.l #2,sp ; conin code doubles as an error status
* move.w #1,-(sp) ; error status
term:
move.w #pterm,-(sp)
trap #gemdos ; and terminate
getch:
* ; return in d0 next character
* ; converting lower case to upper
* ; condition code set EQ if char is NULL
move.b (a6)+,d0
cmp.b #'a',d0
blt.s gcrtn
cmp.b #'z',d0
bgt.s gcrtn
eori.b #$20,d0 ; convert to uppercase
gcrtn:
tst.b d0 ; set condition codes
rts
* ; set new printer configuration
prconf:
move.w d0,-(sp)
andi.w #$3f,d0 ; only these bits meanigful
move.w prcnfg,d1 ; do not change reserved bits
andi.w #%0111111111000000,d1
or.w d1,d0
move.w #setprt,-(sp)
trap #xbios
addq.l #4,sp
oldcnf:
moveq #-1,d0 ; check printer configuration
move.w d0,-(sp)
move.w #setprt,-(sp)
trap #xbios
addq.l #4,sp
move.w d0,prcnfg ; store result in prcnfg
move.w #prnout,prdev ; assume printer on parallel port
btst #4,d0 ; it this true?
beq.s pcfret
move.w #auxout,prdev : no? - change output to aux
pcfret:
rts
cvthx:
* converts ascii character in d0 into hex digit left in d0
* sets HI condition code iff character is not convertible
subi.b #'0',d0
cmpi.b #9,d0
ble.s cvret
subq.b #7,d0 ; diff between '9' and 'A'
cmp.b #$0f,d0
cvret
rts
sendc:
* sends to a printer hex codes which follow option -h
* trailing single digit codes ok
* characters escaped with \ represent their own ascii codes
* string is terminated by any not escaped non-hex character
* and its remaining part skipped until blank is reached
* -- sendc returns the folowing info in register d1
* -1 - codes send succesfully
* 0 - cannot send to output device
* 1 - output device is off-line
*
* Warning: lower case escaped characters will not work from
* a desktop, due to a brain damaged upper case conversion by GEM.
*
* ; check if otput device is available
moveq #1,d1
move.w #poutst,-(sp)
cmpi.w #prnout,prdev
beq.s chkdv
addq.w #2,(sp) ; ask for status of rs232
chkdv:
trap #gemdos
addq.l #2,sp
tst.w d0
beq.s skips
sndnxt:
bsr getch
beq.s sret
moveq #0,d1
cmp.b #'\',d0
bne.s cnvt1
move.b (a6)+,d0
beq.s sret
move.b d0,d1
bra.s print0
cnvt1:
bsr.s cvthx
bhi.s skips
move.b d0,d1
bsr getch
bne.s nxtcv
bsr printc
moveq #0,d0
bra.s sret
nxtcv:
bsr.s cvthx
bhi.s prnt1
lsl.b #4,d1
add.b d0,d1
print0:
bsr printc
beq.s skips
bra.s sndnxt
prnt1:
bsr printc
skips:
bsr getch
beq.s sret
cmpi.b #' ',d0
bne.s skips
cmpi.b #tab,d0
bne.s skips
sret:
rts
printc:
move.w d1,-(sp)
move.w prdev,-(sp)
trap #gemdos
addq.l #4,sp
move.w d0,d1 ; move result flag to d1
rts
shwcnf:
move.w prcnfg,d2
lsl.w #8,d2
lsl.w #2,d2
moveq #5,d3
move.w #'0',d4
nxtbit:
move.w d4,-(sp)
lsl.w #1,d2
bcc.s show
addq.w #1,(sp)
show:
move.w #conout,-(sp)
trap #gemdos
addq.l #4,sp
dbra d3,nxtbit
pea.l retmsg
move.w #cconws,-(sp)
trap #gemdos
addq.l #6,sp
rts
newcnf:
bsr getch
beq.s unget
bsr cvthx
bhi.s nret
move.b d0,d1
bsr getch
beq.s unget
bsr cvthx
bhi.s nret
lsl.b #4,d1
add.b d0,d1
move.w d1,d0
bclr #15,d0
bsr prconf
nret:
rts
unget:
subq.l #1,a6 ; we will test terminator once again
rts
.data
usemsg: dc.b 'usage: prtset [-c|-s] [-o|-n<hex>] [-h<hex>]',cr,lf
dc.b tab,'-c|-s',tab,'continuous | single-sheet',cr,lf
dc.b tab,'-o|-n',tab,'old | new configuration',cr,lf
dc.b tab,'-h<hex>',tab,'codes to send',cr,lf
dc.b tab,tab,'where codes are hex or \escaped literals'
retmsg: dc.b cr,lf,0
somearg:
dc.b 0
.even
.bss
rpcnfg: ds.w 1
prdev: ds.w 1
end